import Vue from 'vue'
import  * as apis from '../../services/apis'
import * as types from '../mutation-types'
import http from '../../http'

const state = {
  searchProList: [],
}

const getters ={
  searchProList: state => state.searchProList
}

const actions ={
  getSearchPro ({commit},payload) {
    Vue.http.post(apis.GET_SEARCH_PRO, {keyword:payload.keyword,dir:payload.dir,orderBy:payload.orderBy}).then((res) => {
     commit(types.GET_SEARCH_PRO, res.body.result)
   })
  }
}

const mutations ={
  [types.GET_SEARCH_PRO](state,payload){
    state.searchProList = payload.resultList
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
